{% extends 'indexBase.html' %}

{% block title %}创建源码-源码管理-源码管理系统{% endblock %}
{% block description %}<meta name="description" content="创建源码" />{% endblock %}
{% block keywords %}<meta name="keywords" content="创建源码" />{% endblock %}
{% block js %}
<script type="text/javascript" src="{{request.basePath}}/js/common.js?{{request.PUBLISH_FLAG}}"></script>
{% endblock %}

{% block content %}
	<table cellSpacing="0" cellPadding="0"  border="0" class="dfgl">
	  <TR>
	    <TD class="top_bottom">&nbsp;
	      <span class="h1">·创建源码</span>
	    </TD>
	  </TR>
	  <TR>
	    <TD class="mid">
	      <form method="post" id="" action="{{request.basePath}}{{request.path}}?type={{request.GET.type}}&traceId={{request.traceId}}" onsubmit="return sourceCodeCreate()">
		<table  width="100%" border="0" cellpadding="0" cellspacing="0">
		  <tr>
	            <td>
		      {% if message %}
		      <p class="pErrorInfo">
			<font color="red">{{message}}</font>
		      </p>
		      {% endif %}
		      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="infoList">
			<tbody>
			  <tr>
			    <th width="15%">名称</th>
			    <td>
			      {% ifequal isEdit 'True' %}
			      <input type="text" name="name" value="{{sourceCode.name}}" size="25" 
				     maxlength="20" class="input0" onblur="dealNamePrompt()" />
			      {% else %}
			      <input type="text" name="name" value="{{request.POST.name}}" size="25" 
				     maxlength="20" class="input0" onblur="dealNamePrompt()" />
			      {% endifequal %}
			      <font color="red">*</font>
			      <font color="red" id="nameNotEmpty" style="display: none;">名称不能为空！</font>
			    </td>
			  </tr>
			  <tr>
			    <th>所属项目</th>
			    <td>
			      <select name="project_id">
			      <option value="">请选择</option>
			      {% for item in projectLi %}
					<option value="{{item.id}}">{{item.name}}</option>
					{% endfor %}
					</select>
					{% ifequal request.method 'GET' %}
				      <script type="text/javascript">
					document.forms[0].project_id.value = "{{sourceCode.project_id}}";
				      </script>
				      {% else %}
				      <script type="text/javascript">
					document.forms[0].project_id.value = "{{request.POST.project_id}}";
				      </script>
				      {% endifequal %}
			    </td>
			  </tr>
			  <tr>
			    <th>注释</th>
			    <td>
			      {% ifequal isEdit 'True' %}
			      <textarea name="comment" rows="5" cols="100" class="textarea" onblur="dealCommentPrompt()">{{sourceCode.comment}}</textarea>
			      {% else %}
			      <textarea name="comment" rows="5" cols="100" class="textarea" onblur="dealCommentPrompt()">{{request.POST.comment}}</textarea>
			      {% endifequal %}
			      <font color="red">*</font>
			      <font color="red" id="commentNotEmpty" style="display: none;">注释不能为空！</font>
			      <font color="red" id="commentLengthNotValid" style="display: none;">注释长度不能超过150！</font>
			    </td>
			  </tr>
			  <tr>
			    <th>源代码</th>
			    <td>
			      {% ifequal isEdit 'True' %}
			      <textarea name="content" rows="10" cols="100" class="textarea" onblur="dealSourceCodePrompt()">{{sourceCode.content}}</textarea>
			      {% else %}
			      <textarea name="content" rows="10" cols="100" class="textarea" onblur="dealSourceCodePrompt()">{{request.POST.content}}</textarea>
			      {% endifequal %}
			      <font color="red">*</font>
			      <font color="red" id="sourceCodeNotEmpty" style="display: none;">源代码不能为空！</font>
			    </td>
			  </tr>
			  <tr>
			    <th>替换文本</th>
			    <td>
			      {% ifequal isEdit 'True' %}
			      {% for item in sourceCode.origLi %}
			      <p>
			      原始文本{{forloop.counter}}:<input type="text" id="orig{{forloop.counter}}" name="orig{{forloop.counter}}" value="{{item}}" />
			      </p>
			      {% endfor %}
			      {% else %}
			      {% for item in tenLi %}
			      <p>
			      原始文本{{item}}:<input type="text" id="orig{{item}}" name="orig{{item}}" value="" />
			      </p>
			      {% endfor %}
			      {% endifequal %}
			    </td>
			  </tr>
			</tbody>
	    	      </table>

		      <p class="pLeft marginTop6px">
			<input type="submit" value="保存" class="bn_2" />
			{% ifequal isEdit 'True' %}
			<input type="button" value="返回" class="bn_2" 
			       onclick="location.href='{{request.basePath}}/index/sourcecode/{{sourceCode.id}}?type={{request.GET.type}}&traceId={{request.traceId}}'" />
			{% else %}
			<input type="button" value="返回" class="bn_2" 
			       onclick="location.href='{{request.basePath}}/index/sourcecode?type={{request.GET.type}}&traceId={{request.traceId}}'" />
			{% endifequal %}
		      </p>
	    	    </td>
		  </tr>
		</table>
	      </form>
	    </td>
	  </tr>
	  <tr>
            <td class="top_bottom">
              &nbsp;
            </td>
	  </tr>
	</table>
{% endblock %}
